<template>
  <el-input
    class="w-50 m-2 inputBox"
    size="large"
    placeholder="输入要搜索的内容"
    :suffix-icon="Search"
    v-model="searchText"
    @keyup.enter="toEssay"
  />
</template>

<script lang="ts">
import { defineComponent, reactive, toRefs, ref } from "vue";
import { Search } from "@element-plus/icons-vue";
import { useRouter } from "vue-router";

export default defineComponent({
  name: "",
  setup() {
    let searchText = ref("");
    let router = useRouter();
    function toEssay() {
      router.push({
        name: "useressay",
        params: {
          searchText: searchText.value,
        },
      });
    }
    return {
      Search,
      searchText,
      toEssay,
    };
  },
});
</script>

<style scoped lang="scss">
.inputBox {
  width: 20rem;
  margin-top: 1rem;
}
</style>
